// 依赖
import $ from './jquery.min.js';
import config from './config.js';



function post(url, params) {
	url = config.apiUrl + url;
	if (config.develop)
		console.log(url, params)
	return new Promise((resolve, reject) => {
		$.post(url, params, function(res, status) {
			if (config.develop)
				console.log(res, status)
			if (status == 'success') {
				res=JSON.parse(res)
				res = res.result;
				console.log(res)
				resolve(res);
			} else {
				reject(res);
				console.log('err!' + JSON.stringify(res));
			}

		});
	});
}

export default {
	post
}
